package sm.upgrade;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;

import sm.upgrade.api.UpgradePhase;

public class DeleteInboxGLUpgrade implements UpgradePhase {

	private static Logger logger = LoggerFactory.getLogger(UpgradePhase.class);

	private HibernateTemplate template;

	public void setTemplate(HibernateTemplate template) {
		this.template = template;
	}

	@Override
	public void upgrade() {
		Object inbox = template.get("globallists", "inboxes");
		if (inbox != null) {
			template.delete("globallists", inbox);
			if (logger.isDebugEnabled()) {
				logger.debug("Delete global list record which name = inboxes");
			}
		}
	}

}
